/**
 * @Author: code.rookie
 * @ClassName: JumpGame
 * @PACKAGE_NAME: PACKAGE_NAME
 * @Version: 1
 */
public class JumpGame {
    public boolean canJump(int[] nums) {
        int length = nums.length;
        int rightmost = 0;
        for(int size = 0; size < length; size++) {
            if(size <= rightmost) {
                rightmost = Math.max(rightmost, size + nums[size]);
                if(rightmost >= length - 1) {
                    return true;
                }
            }
        }

        return false;
    }
}
